package by.ostrovsky.webhousingsystem.constants;

import java.util.LinkedHashMap;
import java.util.Map;

public abstract class Constants {
	private static Map<Integer,String> ACCESS_LEVEL = null;
	
	public final static String LOGIN = "login";
	public final static String PASSWORD1 = "password1";
	public final static String PASSWORD2 = "password2";
	public final static String USERNAME = "username";
	public final static String MAIL = "mail";
	public final static String LEVEL = "level";
	public final static String INCORRECT_PARAMETER = "incorrect parameter";
	public final static String EMPTY_FIELD = "Empty field(s)!";
	public final static String INCORRECT_REG_DATA = "Incorrect data!";
	public final static String PASSWORD_NOT_EQUAL = "password not equal";
	public final static String LOGIN_ALREADY_EXISTS = "Login already exists";
	public final static String INCORRECT_PASSWORD_FORMAT = "incorrect password format";
	public final static String ACCOUNT = "account";
	public final static String SUCCESS = "success";
	public final static String SUCCESS_REG_MESSAGE = "Now log in!";
	
	public final static String LEVEL_USER_SUCCESS = "level_user_success";
	public final static String LEVEL_PRIVILEGEDUSER_SUCCESS = "level_privilegeduser_success";
	public final static String LEVEL_MANAGER_SUCCESS = "level_manager_success";
	public final static String LEVEL_ADMIN_SUCCESS = "level_admin_success";
	public final static String LEVEL_ROOT_SUCCESS = "level_root_success";
	
	public final static String FAILURE = "failure";
	public final static String ACCESS_DENIED = "accessDenied";
	public final static String FATAL = "fatal";
	public final static String REASON = "reason";
	public final static String INCORRECT_DATA = "Incorrect login or password!";
	public final static String USERLOGIN = "userlogin";
	public final static String USER_LOGGED_IN = "user logged in!";
	public final static String REQUEST_SENT = "user request sent!";
	public final static String REQUEST_NOT_SENT = "fail sending request!";	
	
	public final static String LEVEL_USER = "user";
	public final static String LEVEL_PRIVILEGEDUSER = "privilegeduser";
	public final static String LEVEL_MANAGER = "manager";
	public final static String LEVEL_ADMIN = "admin";
	public final static String LEVEL_ROOT = "root";
	
	static {
		ACCESS_LEVEL = new LinkedHashMap<Integer,String>();
		ACCESS_LEVEL.put(0, LEVEL_USER);
		ACCESS_LEVEL.put(1, LEVEL_PRIVILEGEDUSER);
		ACCESS_LEVEL.put(2, LEVEL_MANAGER);
		ACCESS_LEVEL.put(3, LEVEL_ADMIN);
		ACCESS_LEVEL.put(4, LEVEL_ROOT);
	}
	
	public static String getAccessLevelByKey(int key){
		return ACCESS_LEVEL.get(key);
	}
}
